const Service = require('egg').Service;

class CommentService extends Service {
  async comment_add(params) {
    const Comment = this.ctx.model.Comment,
          newComment = new Comment(params);
    return await this.ctx.model.Comment.add(newComment);
  }
  async reply_add(params) {
    const Reply = this.ctx.model.Reply,
          newReply = new Reply(params);
    console.log('12.....', newReply);
    return await this.ctx.model.Reply.add(newReply);
  }
  async comment_update(params) {
    return await this.ctx.model.Comment.update(params);
  }
  async comment_list(aid) {
    return await this.ctx.model.Comment.findAll(aid);
  }
  async reply_list(cid) {
    return await this.ctx.model.Reply.findAll(cid);
  }
}

module.exports = CommentService;